glob |
您所在的位置:网站首页 › python range的范围 › glob |
Return a possibly empty list of path names that match pathname, which must be a string containing a path specification. pathname can be either absolute (like /usr/src/Python-1.5/Makefile) or relative (like ../../Tools/*/*.gif), and can contain shell-style wildcards. Broken symlinks are included in the results (as in the shell). Whether or not the results are sorted depends on the file system. If a file that satisfies conditions is removed or added during the call of this function, whether a path name for that file will be included is unspecified. 如果 root_dir 不为 None,则它应当是指明要搜索的根目录的 path-like object。 它用在 glob() 上与在调用它之前改变当前目录有相同的效果。 如果 pathname 为相对路径,结果将包含相对于 root_dir 的路径。 本函数带有 dir_fd 参数,支持 基于目录描述符的相对路径。 如果 recursive 为真值,则模式 "**" 将匹配目录中的任何文件以及零个或多个目录、子目录和符号链接。 如果模式加了一个 os.sep 或 os.altsep 则将不匹配文件。 If include_hidden is true, "**" pattern will match hidden directories. 引发一个 审计事件 glob.glob 附带参数 pathname, recursive。 引发一个 审计事件 glob.glob/2,附带参数 pathname, recursive, root_dir, dir_fd。 备注 在一个较大的目录树中使用 "**" 模式可能会消耗非常多的时间。 在 3.5 版本发生变更: 支持使用 "**" 的递归 glob。 在 3.10 版本发生变更: 添加了 root_dir 和 dir_fd 形参。 在 3.11 版本发生变更: Added the include_hidden parameter. |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |